Cytosim  PI
Cytoskeleton Simulator
SimThread::TryLock Class Reference

Detailed Description

A TryLock can be created to access the simulation state if it is running live. The constructor will try to lock the simulation, but this may fail.

TryLock::status() will return 0 if the lock was acquired.

Any acquired lock will be released when the TryLock goes out of scope.

Public Member Functions

 TryLock (SimThread *p)
 Stop the simulation, create a pthread lock and call simul.relax();.
 
int status () const
 return 0 if the lock was acquired, and pthread_mutex_trylock error code otherwise
 
 ~TryLock ()
 Release the pthread lock.